package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.VipboardingLinkAirline;
import com.ktgj.service.service.IVipboardingLinkAirlineService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 值机--机场支持航司服务Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/airline")
public class VipboardingLinkAirlineController extends BaseController
{
    @Autowired
    private IVipboardingLinkAirlineService vipboardingLinkAirlineService;

    /**
     * 查询值机--机场支持航司服务列表
     */
    @PreAuthorize(hasPermi = "service:airline:list")
    @GetMapping("/list")
    public TableDataInfo list(VipboardingLinkAirline vipboardingLinkAirline)
    {
        startPage();
        List<VipboardingLinkAirline> list = vipboardingLinkAirlineService.selectVipboardingLinkAirlineList(vipboardingLinkAirline);
        return getDataTable(list);
    }

    /**
     * 导出值机--机场支持航司服务列表
     */
    @PreAuthorize(hasPermi = "service:airline:export")
    @Log(title = "值机--机场支持航司服务 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VipboardingLinkAirline vipboardingLinkAirline) throws IOException
    {
        List<VipboardingLinkAirline> list = vipboardingLinkAirlineService.selectVipboardingLinkAirlineList(vipboardingLinkAirline);
        ExcelUtil<VipboardingLinkAirline> util = new ExcelUtil<VipboardingLinkAirline>(VipboardingLinkAirline.class);
        util.exportExcel(response, list, "值机--机场支持航司服务 数据");
    }

    /**
     * 获取值机--机场支持航司服务详细信息
     */
    @PreAuthorize(hasPermi = "service:airline:query")
    @GetMapping(value = "/{boardingAirlineid}")
    public AjaxResult getInfo(@PathVariable("boardingAirlineid") Long boardingAirlineid)
    {
        return AjaxResult.success(vipboardingLinkAirlineService.selectVipboardingLinkAirlineById(boardingAirlineid));
    }

    /**
     * 新增值机--机场支持航司服务
     */
    @PreAuthorize(hasPermi = "service:airline:add")
    @Log(title = "值机--机场支持航司服务 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VipboardingLinkAirline vipboardingLinkAirline)
    {
        return toAjax(vipboardingLinkAirlineService.insertVipboardingLinkAirline(vipboardingLinkAirline));
    }

    /**
     * 修改值机--机场支持航司服务
     */
    @PreAuthorize(hasPermi = "service:airline:edit")
    @Log(title = "值机--机场支持航司服务 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VipboardingLinkAirline vipboardingLinkAirline)
    {
        return toAjax(vipboardingLinkAirlineService.updateVipboardingLinkAirline(vipboardingLinkAirline));
    }

    /**
     * 删除值机--机场支持航司服务
     */
    @PreAuthorize(hasPermi = "service:airline:remove")
    @Log(title = "值机--机场支持航司服务 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{boardingAirlineids}")
    public AjaxResult remove(@PathVariable Long[] boardingAirlineids)
    {
        return toAjax(vipboardingLinkAirlineService.deleteVipboardingLinkAirlineByIds(boardingAirlineids));
    }
}
